package main

import "fmt"

func main() {
	//创建指针
	var p1 *int       //空指针 值为nil
	var p2 = new(int) //非空指针 被创建的指针指向的值为默认值
	fmt.Println("p1 = ", p1)
	fmt.Println("p2 = ", p2)
	//指针赋值
	s := 99999
	p1 = &s
	p2 = &s
	//打印指针地址
	fmt.Println("p1 = ", p1)
	fmt.Println("p2 = ", p2) //p2的指针与上一次不一样
	//打印指针的值
	fmt.Println("p1 = ", *p1)
	fmt.Println("p2 = ", *p2)

}
